#include "tests.h"


void testRuletangle (void)
{
	LongInstance major("111111111", 1);
	LongInstance minor("111111111", 0);
	major.addCoordinate(0,0);
	major.addCoordinate(0,100);
	major.addCoordinate(100,0);
	major.addCoordinate(100,100);
	major.addCoordinate(50,50);
	major.addCoordinate(30,50);
	minor.addCoordinate(40,40);
	minor.addCoordinate(60,60);
	minor.addCoordinate(70,70);
	minor.addCoordinate(30,30);
	minor.addCoordinate(20,80);

	Ruletangle2 rl2(major,minor);
	rl2.printDetail();
}

void testTXT2BMP (void)
{
	setImageToWhite("01b.bmp");
	txt2bmp("256gradient_in.txt","01b.bmp", "green");
	bmp2txt("01b.bmp", "256gradient_out2.txt");
	bmp2txt("01b.bmp", "256gradient_out2.txt", "green");
	txt2bmp("256gradient_out2.txt","01b2.bmp", "red");

	bmp2txt("gangyBW.bmp", "gangy.txt", "average");
	setImageToWhite("gangytemp.bmp");
	txt2bmp("gangy.txt","gangytemp.bmp", "red");

	txt2bmp_bw("image1_bit0.txt", "343x480.bmp");

	separateImageBits ("img\\tom", "bmp", 8);

	CBitmap mybitmap("img\\t10.bmp");
	mybitmap.separateBits("txt\\t10-", "txt");
}

void testELfromBMP (void)
{
	EightLayerIM el("img\\2x15", 8);
	for (int i = 0; i < 3; i++)
		el.printLayer(i);

	EightLayerIM eim1("img\\tom", 8, "bmp");
	RuleBase rb (eim1,0,1);
	rb.print();
	rb.printDetail();
	cout << rb.totalConflicts() << endl;
}

void testSingleStep (void)
{
	SingleStep s1("img\\tom", 7, "bmp");
	cout << "\n\nSingleStep object created using " << s1.getRuletangleNum() << " Ruletangles.\n"; 
	s1.print();
	cout << "Information size stored in s1: " << s1.getNetInfoSizeInBits() << endl;
	EightLayerIM e1("t1", 1);
	//e1.printLayer(0);
	//e1.printLayer(1);
	s1.apply(e1);
	e1.printLayer(1);
}